/**
  ETFAna project, Anyang Normal University && IMP-CAS
  \class ETFParticle
  \brief to store particle information of lighter fragments, e.g., proton,
  deutron, pion, etc.
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2023-06-03
  \date 2023-06-06 last modified
  \attention
  changelog
  <table>
  <tr>  <th>Date         <th>Author      <th>Description                    </tr>
  <tr>  <td>2023-06-06   <td>Asia Sun    <td>file created                   </tr>
  </table>

  \copyright Copyright (c) 2021-2024 Anyang Normal U. && IMP-CAS with LGPLv3 LICENSE
*/

#include <iostream>
#include "ETFParticle.h"
#include "ETFMath.h"

using std::cout;
using std::endl;

const double ETFParticle::DEG = ETFMath::DEGREE();
const double ETFParticle::RAD = 1./ETFParticle::DEG;
const double ETFParticle::c0 = ETFMath::c0();
const double ETFParticle::CC = ETFMath::CC(); // 0.32184060506023993
const double ETFParticle::u0 = ETFMath::uMeV(); // 931.494061
const double ETFParticle::z1 = ETFMath::zMagIn();
const double ETFParticle::z2 = ETFMath::zMagOut();

ETFParticle::ETFParticle() : TObject(){
  Initialize();
} // end ctor

ETFParticle::~ETFParticle(){}

void ETFParticle::Initialize(){
  index = -9999;
  aoz = -999.;
  poz = -999.;
  z = -999.;
  beta = -1.;
  gamma = -999.;
  bm2 = -999.;
  tof2 = trkLenT = -999.;
  dtheta = -999.;
  rho = brho = -999.;
  xo = zo = -999.;
  ki = bi = -999.;
  k1 = b1 = -999.;
  k2 = b2 = -999.;
  x1 = x2 = -999.;
  dcArrId = -1;
} // end initialize

void ETFParticle::Print(const char *) const{
  cout << "Event index: " << index << endl;
  cout << "Belonging to DC Arr: " << (dcArrId ? "postMagTracker" : "mpostMagTracker") << endl;
  cout << "aoz: " << aoz << "\tz: " << z << "\tpoz: " << poz << " MeV/c" << endl;
  cout << "beta: " << beta << "\tgamma: " << gamma << endl;
  cout << "Total flight path length: " << trkLenT << " mm" << endl;
  cout << "tof2 (from tstop to TOFWall): " << tof2 << " ns" << endl;
  cout << "dtheta: " << dtheta << " degree\tbrho: " << brho << "T.m" << endl;
  cout << "rho: " << rho << " mm, center (zo, xo), zo: ";
  cout << zo << " mm\txo: " << xo << " mm" << endl;
  cout << "ki: " << ki << "\tbi: " << bi << endl;
  cout << "k1: " << k1 << "\tb1: " << b1 << endl;
  cout << "k2: " << k2 << "\tb2: " << b2 << endl;
  cout << "x1: " << x1 << "\tx2: " << x2 << endl;
  cout << "Parallel momentum: " << pozp << " MeV/c" << endl;
  cout << "Transverse momentum: " << pozt << " MeV/c" << endl;
} // end member function print
